using Microsoft.Extensions.DependencyInjection;
using SG3L_RAG.Application.Interfaces;
using SG3L_RAG.Application.Services;

namespace SG3L_RAG.Application
{
    public static class ServiceCollectionExtension
    {
        public static IServiceCollection AddApplicationServices(this IServiceCollection services)
        {
            // 注册应用服务
            services.AddScoped<IUserService, UserService>();
            services.AddScoped<IDocumentService, DocumentService>();
            services.AddScoped<IDocumentChunkService, DocumentChunkService>();
            services.AddScoped<IConversationService, ConversationService>();
            services.AddScoped<IMessageService, MessageService>();
            services.AddScoped<IPermissionService, PermissionService>();
            services.AddScoped<IStatisticsService, StatisticsService>();
            services.AddScoped<ILogService, LogService>();
            services.AddScoped<IDocumentProcessingService, DocumentProcessingService>();
            
            // 注册认证相关服务
            services.AddScoped<IAuthService, AuthService>();
            services.AddScoped<IJwtService, JwtService>();
            
            // 注册RAG相关服务
            services.AddScoped<HttpClient>();
            services.AddScoped<IChatService, ChatService>();
            services.AddScoped<IAIService, DeepSeekAIService>();
            services.AddScoped<IVectorSearchService, VectorSearchService>();

            // 注册 MediatR
            // services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(typeof(ServiceCollectionExtension).Assembly));

            // 注册 AutoMapper
            // services.AddAutoMapper(typeof(ServiceCollectionExtension).Assembly);

            // 注册 FluentValidation
            // services.AddValidatorsFromAssembly(typeof(ServiceCollectionExtension).Assembly);

            return services;
        }
    }
}